package com.oocl.oopdemo.sixday;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import org.junit.Test;

public class FileTest {

	@Test
	public void test() throws IOException{
		File f=new File("D:\\workspace_my\\2017");
		System.out.println(f.isDirectory());
		
		if(f.isDirectory()){
			File chid=new File(f.getAbsolutePath()+"\\chid");
			chid.mkdir();
			File grandChild=new File(chid.getAbsolutePath()+"\\grandchid");
			grandChild.createNewFile();
			FileOutputStream fos=new FileOutputStream(grandChild);
			for (int i = 0; i < 100; i++) {
				fos.write(i);
			}
			fos.close();
			System.out.println(grandChild.length());
		}
		
		File[] f1=f.listFiles();
		for (File file:f1) {
			System.out.println(file.getName());
			
		}
	}
}
